<template>
  <h1>Vuex5代---Pinia</h1>
  <el-button @click="updateUser">action更新数据</el-button>
  <el-button @click="patchClick">$patch更新数据</el-button>
  <div>{{ userStore.name }}</div>
  <div>{{ userStore.count }}</div>
</template>
<script setup lang="ts">
import { reactive, ref } from "vue";
import { useUserStore } from "@/store/index";

const userStore = useUserStore();
const updateUser = () => {
  userStore.updateName("李四");
};
const patchClick = () => {
  // userStore.$patch((state) => {
  //   state.count++;
  // });
  userStore.$patch({
    count: userStore.count + 1,
  });
};
</script>

<style scoped></style>
